package com.guangyuan.network.util;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import org.apache.log4j.Logger;

public class FetchObjectInformation {
	private static Logger logger = Logger
			.getLogger(FetchObjectInformation.class);

	public static void fetchInformation(Object obj) {
		Method[] methods = obj.getClass().getDeclaredMethods();

		for (Method method : methods) {
			if (method.getName().startsWith("get")) {
				try {
					System.out.println("|-- " + method.getName() + " : "
							+ method.invoke(obj, null));
				} catch (IllegalArgumentException e) {
					logger.error(e.getMessage());

				} catch (IllegalAccessException e) {
					logger.error(e.getMessage());
				} catch (InvocationTargetException e) {
					logger.error(e.getMessage());
				}
			}
		}

	}
}
